<template>
  <el-select :placeholder="$t('common.selectCustomer')" clearable filterable v-model="customer" :disabled="disabled">
    <el-option
      v-for="customer in customerList"
      :key="customer.id"
      :label="customer.customerName"
      :value="customer.id"
    ></el-option>
  </el-select>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
  props: ['value','size', 'disabled'],
  data() {
    return {

    }
  },
  computed: {
    ...mapGetters(['customerList']),
    customer: {
      get() {
        return this.value;
      },
      set(v) {
        const label = this.customerList.find(r=>r.id === v).customerName
        this.$emit('getName', label)
        this.$emit('input', v);
      }
    }
  },
  created() {
    if(this.value) {
      const label = this.customerList.find(r=>r.id === this.value).customerName
      this.$emit('getName', label)
    }
  },
  methods: {
  }
}
</script>
